﻿#ifndef _OI_PLSCANNERCORE_PRODUCTWIDGET_HPP_
#define _OI_PLSCANNERCORE_PRODUCTWIDGET_HPP_

#include "PLScannerCore/OiPLScannerCore.hpp"

namespace Oi
{
    namespace PLScannerCore
    {
        class ProductParams;

        class OI_PLSCANNER_CORE_API ProductWidget : public QWidget
        {
            Q_OBJECT
            
        public:
            ProductWidget(ProductMeasurePage type = PMP_ThicknessMeasure, QWidget * parent = nullptr);

            ~ProductWidget();

            void setParams(const QString name, const ProductParams params);

            void updateParams();

            ProductParams parmas();

            QString name() const;

            void setEditable(bool);

            QString getThicknessValue();

        protected:

            bool eventFilter(QObject *obj, QEvent *evt);

        private slots:
            void onEnterAcquire();

            void onLeaveAcquire();

        public slots:
            void setProfile(const OiProfiles& profiles);

        public slots:

            void setConfig(QVariantMap);

            void onEditFinished();

            void onSetting();

            void onAcquire();

            void onCreate();

            void onClearView();

            void onTypeChanged();

            void onMeasure();

            void onFixedMeasure();

            void onEditTool(const int id, const int type);

            void onAddTool(const QPointF p);

            void onDelTool(const int id);

        private:
            OI_DECLARE_IMPL(ProductWidget);
            OI_DISABLE_COPY(ProductWidget);
        };
    }
}


#endif
